package com.demo.java.runa;

import java.util.Map;

public class TestTimedWaiting implements Runnable{

    Map<String,Thread> threadMap;
    public TestTimedWaiting(Map<String,Thread> threadMap){
        this.threadMap = threadMap;
    }

    @Override
    public void run() {
        testWaiting(threadMap);
    }

    public synchronized static void testWaiting(Map<String,Thread> threadMap) {
        try {
            long startSec = System.currentTimeMillis()/1000;
            while(true){
                long passSec = System.currentTimeMillis()/1000-startSec;
                if(passSec>=3){
                    break;
                }
            }
            Thread.sleep(5000);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
